//
//  MKUIElementViewSelection.h
//  MKUI
//  可单选(多选)值
//  Created by 苏尚进 on 2023/7/12.
//  Copyright © 2023 moon. All rights reserved.
//

#import "MKUIElementViewDetail.h"
#import "MKUIElementSelectOptionViewController.h"

NS_ASSUME_NONNULL_BEGIN
@interface MKUIElementViewSelection : MKUIElementViewDetail
@property(nonatomic,strong,nullable) NSArray<MKUIElementSelectOption *> *options;//选项
@property(nonatomic,assign) BOOL allowsMultipleSelection;//是否允许多选，默认为NO

@property(nonatomic,strong,nullable) MKUIElementSelectOption *selectedOption;//选中的选项（单选）
@property(nonatomic,strong,nullable) id selectedValue;//选中的选项的值（单选）

@property(nonatomic,strong,nullable) NSArray<MKUIElementSelectOption *> *selectedOptions;//选中的选项（多选）
@property(nonatomic,strong,nullable) NSArray *selectedValues;//选中的选项（多选）

@property(nonatomic,strong,nullable) NSString * detailTextWhenNoSelected;//没有选中值时，detailText的值
@property(nonatomic,readonly,nullable) NSString *detailTextWithSelectedOptions;//返回选中的项的text值，多选时以,分隔
@property(nonatomic,copy,nullable) void(^whenDone)(__kindof MKUIElementViewSelection *el);//选项变更的回调
@property(nonatomic,strong,nullable) NSString *doneButtonText;//完成按钮的文字，默认显示Done
- (void)beginSelectOption;//开始进行选择
@property(nonatomic,assign) Class optionCellClass;//默认为MKUIElementSelectOptionTableViewCell
@end
NS_ASSUME_NONNULL_END

NS_ASSUME_NONNULL_BEGIN
@interface MKUIElementListViewCellSelection : MKUIElementListViewCellBase
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-property-synthesis"
@property(nonatomic,readonly,nullable) __kindof MKUIElementViewSelection *elementView;
#pragma clang diagnostic pop
@end
NS_ASSUME_NONNULL_END

NS_ASSUME_NONNULL_BEGIN
@interface MKUIElementTableViewCellModelSelection : MKUIElementTableViewCellModelDetail
@property(nonatomic,strong,nullable) NSArray<MKUIElementSelectOption *> *el_options;//选项
@property(nonatomic,assign) BOOL el_allowsMultipleSelection;//是否允许多选，默认为NO

@property(nonatomic,strong,nullable) MKUIElementSelectOption *el_selectedOption;//选中的选项（单选）
@property(nonatomic,strong,nullable) id el_selectedValue;//选中的选项的值（单选）

@property(nonatomic,strong,nullable) NSArray<MKUIElementSelectOption *> *el_selectedOptions;//选中的选项（多选）
@property(nonatomic,strong,nullable) NSArray *el_selectedValues;//选中的选项（多选）

@property(nonatomic,strong,nullable) NSString * el_detailTextWhenNoSelected;//没有选中值时，detailText的值
@property(nonatomic,copy,nullable) void(^el_whenSelectionDone)(__kindof MKUIElementTableViewCellModelSelection *cm);//选项变更的回调
@property(nonatomic,strong,nullable) NSString *el_doneButtonText;//完成按钮的文字，默认显示Done

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-property-synthesis"
@property(nonatomic,readonly,nullable) __kindof MKUIElementViewSelection *el_elementView;
#pragma clang diagnostic pop
@end

@interface MKUIElementTableViewCellSelection : MKUIElementTableViewCellDetail
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-property-synthesis"
@property(nonatomic,readonly,nullable) __kindof MKUIElementViewSelection *elementView;
#pragma clang diagnostic pop
- (void)beginSelectOption;//开始进行选择
@end
NS_ASSUME_NONNULL_END
